/*  1:   */ package org.jetbrains.jps.model.artifact.impl;
/*  2:   */ 
/*  3:   */

import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementCollection;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactReference;
import org.jetbrains.jps.model.artifact.JpsArtifactService;
import org.jetbrains.jps.model.artifact.JpsArtifactType;
import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */
/* 17:   */ 
/* 18:   */ public class JpsArtifactServiceImpl
/* 19:   */   extends JpsArtifactService
/* 20:   */ {
/* 21:   */   public List<JpsArtifact> getArtifacts(@NotNull JpsProject paramJpsProject)
/* 22:   */   {
/* 23:40 */     if (paramJpsProject == null) {
/* 24:40 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "getArtifacts" }));
/* 25:   */     }
/* 26:40 */     JpsElementCollection localJpsElementCollection = (JpsElementCollection)paramJpsProject.getContainer().getChild(JpsArtifactRole.ARTIFACT_COLLECTION_ROLE);
/* 27:41 */     return localJpsElementCollection != null ? localJpsElementCollection.getElements() : Collections.emptyList();
/* 28:   */   }
/* 29:   */   
/* 30:   */   public List<JpsArtifact> getSortedArtifacts(@NotNull JpsProject paramJpsProject)
/* 31:   */   {
/* 32:46 */     if (paramJpsProject == null) {
/* 33:46 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "getSortedArtifacts" }));
/* 34:   */     }
/* 35:46 */     ArrayList localArrayList = new ArrayList(getArtifacts(paramJpsProject));
/* 36:47 */     Collections.sort(localArrayList, new Comparator()
/* 37:   */     {
/* 38:   */       public int compare(JpsArtifact paramAnonymousJpsArtifact1, JpsArtifact paramAnonymousJpsArtifact2)
/* 39:   */       {
/* 40:50 */         return paramAnonymousJpsArtifact1.getName().compareToIgnoreCase(paramAnonymousJpsArtifact2.getName());
/* 41:   */       }
/* 42:52 */     });
/* 43:53 */     return localArrayList;
/* 44:   */   }
/* 45:   */   
/* 46:   */   public <P extends JpsElement> JpsArtifact addArtifact(@NotNull JpsProject paramJpsProject, @NotNull String paramString, @NotNull JpsCompositePackagingElement paramJpsCompositePackagingElement, @NotNull JpsArtifactType<P> paramJpsArtifactType, @NotNull P paramP)
/* 47:   */   {
/* 48:62 */     if (paramJpsProject == null) {
/* 49:62 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "addArtifact" }));
/* 50:   */     }
/* 51:62 */     if (paramString == null) {
/* 52:62 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "addArtifact" }));
/* 53:   */     }
/* 54:62 */     if (paramJpsCompositePackagingElement == null) {
/* 55:62 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "addArtifact" }));
/* 56:   */     }
/* 57:62 */     if (paramJpsArtifactType == null) {
/* 58:62 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "3", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "addArtifact" }));
/* 59:   */     }
/* 60:62 */     if (paramP == null) {
/* 61:62 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "4", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "addArtifact" }));
/* 62:   */     }
/* 63:62 */     JpsArtifact localJpsArtifact = createArtifact(paramString, paramJpsCompositePackagingElement, paramJpsArtifactType, paramP);
/* 64:63 */     return (JpsArtifact)((JpsElementCollection)paramJpsProject.getContainer().getOrSetChild(JpsArtifactRole.ARTIFACT_COLLECTION_ROLE)).addChild(localJpsArtifact);
/* 65:   */   }
/* 66:   */   
/* 67:   */   public <P extends JpsElement> JpsArtifact createArtifact(@NotNull String paramString, @NotNull JpsCompositePackagingElement paramJpsCompositePackagingElement, @NotNull JpsArtifactType<P> paramJpsArtifactType, @NotNull P paramP)
/* 68:   */   {
/* 69:70 */     if (paramString == null) {
/* 70:70 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "createArtifact" }));
/* 71:   */     }
/* 72:70 */     if (paramJpsCompositePackagingElement == null) {
/* 73:70 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "createArtifact" }));
/* 74:   */     }
/* 75:70 */     if (paramJpsArtifactType == null) {
/* 76:70 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "createArtifact" }));
/* 77:   */     }
/* 78:70 */     if (paramP == null) {
/* 79:70 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "3", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "createArtifact" }));
/* 80:   */     }
/* 81:70 */     return new JpsArtifactImpl(paramString, paramJpsCompositePackagingElement, paramJpsArtifactType, paramP);
/* 82:   */   }
/* 83:   */   
/* 84:   */   public JpsArtifactReference createReference(@NotNull String paramString)
/* 85:   */   {
/* 86:75 */     if (paramString == null) {
/* 87:75 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/artifact/impl/JpsArtifactServiceImpl", "createReference" }));
/* 88:   */     }
/* 89:75 */     return new JpsArtifactReferenceImpl(paramString);
/* 90:   */   }
/* 91:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.artifact.impl.JpsArtifactServiceImpl

 * JD-Core Version:    0.7.0.1

 */